package com.ibeetl.admin.console.service;


import java.util.List;

import org.beetl.sql.core.engine.PageQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ibeetl.admin.console.dao.ArticleConsoleDao;
import com.ibeetl.cms.entity.CmsArticle;
import com.ibeetl.admin.core.service.CoreBaseService;
import com.ibeetl.admin.core.util.PlatformException;






/**
 * CoreArticle Service
 */

@Service
@Transactional
public class ArticleConsoleService extends CoreBaseService<CmsArticle>{

    @Autowired private ArticleConsoleDao articleConsoleDao;

    public PageQuery<CmsArticle>queryByCondition(PageQuery query){
        PageQuery ret =  articleConsoleDao.queryByCondition(query);
        queryListAfter(ret.getList());
        return ret;
    }

    public void batchDelCoreArticle(List<Long> ids){
        try {
        	articleConsoleDao.batchDelCoreArticleByIds(ids);
        } catch (Exception e) {
            throw new PlatformException("批量删除CoreArticle失败", e);
        }
    }
    
    public int upsert(CmsArticle article) {
    	return articleConsoleDao.upsert(article);
    }
}